<template>
  <div>
    <router-view></router-view>
  </div>
  <!-- 全局loading -->
  <loading></loading>
  <!-- <Music /> -->
</template>

<script setup lang="ts">
import { useDark, useToggle } from "@vueuse/core";
import useWebsiteStore from "@/store/modules/website.ts";
import { messageConfig } from "element-plus";
const useWebsite = useWebsiteStore();
onMounted(() => {
  useWebsite.getInfo();
});

//禁止f12、右键
document.onkeydown = (e) => {
  var keyNum = window.event ? e.keyCode : e.which;
  if (keyNum == 123) {
    ElMessage.warning({
      message: "不可以查看源代码哦~",
      ...messageConfig,
    });
    return false;
  }
};
document.oncontextmenu = () => {
  ElMessage.warning({
    message: "不可以右键哦~",
    ...messageConfig,
  });
  return false;
};
//  深色切换
useDark({
  selector: "html",
  attribute: "class",
  valueLight: "light",
  valueDark: "dark",
});

useDark({
  onChanged(dark) {
    useToggle(dark);
  },
});
</script>

<style scoped lang="scss"></style>
